haptic5 2.2.0
Loading...
Searching...
No Matches
main.c File Reference

Haptic 5 Click example. More...

#include "board.h"
#include "log.h"
#include "haptic5.h"

Functions

void application_init (void)
void application_task (void)
int main (void)

Detailed Description

Haptic 5 Click example.

Description

This example demonstrates the control of the Haptic 5 Click board. In I2C mode, the example toggles the haptic trigger pin periodically to generate vibration pulses. In PWM mode, it gradually increases and decreases the output duty cycle to modulate the vibration intensity, while toggling the direction when the duty reaches 0%.

The demo application is composed of two sections :

Application Init

Initializes the logger and the Click board driver, and applies the default configuration.

Application Task

Depending on the selected communication interface (I2C or PWM), toggles the haptic trigger (I2C), or changes PWM duty cycle and direction (PWM).

Note
The mode is selected via the HAPTIC5_DEFAULT_COM macro. Ensure proper configuration and wiring based on the selected mode before running the example.
Author
Stefan Filipovic

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )